<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    
    class Public_page_m extends CI_Model {
        public function __construct() {
            parent::__construct();
        }
        
        function get_all_published_post(){
            $this->db->where('category_id', 1);
            $this->db->where('status', 'published');
            $this->db->where('state', 'show');
            $query = $this->db->get('post');
            
            return $query->result_array();
        }
        
        function get_public_post($post_id) {
            $this->db->where('state', 'show');
            $this->db->where('category_id', 1);
            $this->db->where('post_id', $post_id);
            $query = $this->db->get('post');
            
            return $query->row_array();
        }
        
        function getCourses(){
            return $this->db->get('course');
        }
    }
?>
